<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      h1 {
        color: red;
      }
    </style>
    <link rel="stylesheet" href="index.css" />
  </head>
  <body>
    <div>
      <h1>Classis 2</h1>
      <p>Classis 2</p>
    </div>
    <button id="btn">click me</button>

    <script>
      if (document.readyState === "loading") {
        document.addEventListener("DOMContentLoaded", (event) => {
          console.log("输出:", "hello world");
          const btn = document.getElementById("btn");
          btn.addEventListener("click", function () {
            alert("hello world");
          });
        });
      }
    </script>
  </body>
</html>
